public class Leetcode_14 {
    public static void main(String[] args) {
        int n = 25;
                if (n == 0) {
                    return 0;
                }
                if (n <= 2) {
                    return 1;
                }
                int p = 0, q = 0, r = 1, s = 1;
                for (int i = 3; i <= n; ++i) {
                    p = q;
                    q = r;
                    r = s;
                    s = p + q + r;
                }
        System.out.println(s);
    }
}
